package com.elitect.ftptransfer.module.main.data;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import org.apache.commons.net.ftp.FTPFile;

/**
 * Class to contain the file information. File maybe from FTP server -
 * {@link FTPFile} or local - {@link File}
 * 
 * @author NgocTan
 * 
 */
public class FileItem
{
    private String mName;
    private String mFullPath;
    private long mDate;
    private boolean mIsFile;
    private long mSize;

    public FileItem()
    {
        mDate = System.currentTimeMillis();
        mIsFile = true;
        mName = "";
        mSize = 0;
    }

    public FileItem(String name, String fullPath, long date, boolean isFile,
            long size)
    {
        mDate = date;
        mIsFile = isFile;
        mName = name;
        mSize = size;
        mFullPath = fullPath;
    }

    public String getName()
    {
        return mName;
    }

    public void setName(String name)
    {
        mName = name;
    }

    public String getDateString()
    {
        if (mDate <= 0)
        {
            return "";
        }

        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm",
                Locale.getDefault());
        return format.format(new Date(mDate));
    }

    public long getDate()
    {
        return mDate;
    }

    public void setDate(long date)
    {
        mDate = date;
    }

    public boolean isFile()
    {
        return mIsFile;
    }

    public void setFile(boolean isFile)
    {
        mIsFile = isFile;
    }

    public long getSize()
    {
        return mSize;
    }

    public void setSize(long size)
    {
        mSize = size;
    }

    public String getFullPath()
    {
        return mFullPath;
    }

    public void setFullPath(String fullPath)
    {
        this.mFullPath = fullPath;
    }
}
